// 请求接口方法
import axios from 'axios'
import base from '@/api/base.js'
import md5 from 'md5-js'

// 请求方法
const api = {
  // 病毒新闻信息获取
  getCovInfo () {
    return axios.get(base.host + base.covInfo)
  },
  getChinaData () {
    return axios.get(base.baseUrl + base.ChinaData)
  },
  getCityData (cityName) {
    const rule = md5('appid14184city_name' + cityName + 'formatjson732254652efd5638c66e44c50a7a6820')
    const params = 'format=json&appid=14184&city_name=' + cityName + '&sign=' + rule
    console.log(params)
    return axios.get(base.baseCity + '?' + params)
  },
  getSwiperData () {
    return axios.get(base.swiperData)
  },
  getTravelData () {
    return axios.get(base.travelData)
  },
  getTravelPolicy (params) {
    // params={from:'',to:''}
    return axios.get(base.travelPolicy, {
      params
    })
  }
}

export default api
